package main

import "fmt"

func f() []func() int {
	var g []func() int
	for i := 0; i < 10; i++ {
		j := i // 没这个就出错
		g = append(g, func() int {
			return j
		})
	}

	return g
}

func main() {
	ff := f()
	for _, g := range ff {
		fmt.Println(g())
	}
}
